package com.junyi;

import com.junyi.starter.annotation.Decrypt;
import com.junyi.starter.annotation.Encrypt;
import com.junyi.starter.model.RespBean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @time: 2022/7/14 15:12
 * @version: 1.0
 * @author: junyi Xu
 * @description:
 */
@RestController
public class UserController {

    @GetMapping("/user")
    @Encrypt
    public RespBean getUser() {
        User user = new User();
        user.setId(99L);
        user.setUsername("kk");
        return RespBean.ok("ok", user);
    }

    @PostMapping("/user")
    public RespBean addUser(@RequestBody @Decrypt User user) {
        System.out.println("user = " + user);
        return RespBean.ok("ok", user);
    }
}
